package com.yan.arrays;

public class Test5 {
    public static void main(String[] args) {
        int [] arr = {3,4,3,5,7,9};
        int num = 3;
        int count = frequency(arr , num);
        System.out.println( num +"出现了" + count + "次");

    }

    public static int frequency(int[] arr , int num){
        int count = 0;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == num){
                count++;
            }
        }
        return count;
    }
}
